package com.exchange.View;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.TextUtils.TruncateAt;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.exchange.Controller.ExchangeDataService;
import com.exchange.Controller.a;
import com.exchange.Public.ExchangeConstants;
import com.exchange.Public.f;
import com.exchange.Public.h;
import com.exchange.View.a.a;
import com.exchange.View.a.b;
import com.exchange.View.a.d;
import com.exchange.a.a;
import com.exchange.a.b.a;
import com.exchange.a.c;
import com.exchange.b.a;
import java.util.Iterator;
import java.util.List;

public class ae
  implements t.a
{
  Context a;
  U b;
  ListView c;
  public View d;
  public View e;
  public ViewGroup f;
  public int g;
  public int h;
  public int i;
  public int j;
  public t k;
  private ExchangeDataService l;
  private List<a> m;

  public ae(Context paramContext, ViewGroup paramViewGroup, int paramInt, ExchangeDataService paramExchangeDataService)
  {
    this.a = paramContext;
    this.f = paramViewGroup;
    this.h = paramInt;
    this.l = paramExchangeDataService;
    switch (this.h)
    {
    default:
    case 10:
    }
    while (true)
    {
      return;
      this.i = 1;
      this.g = a.u(this.a);
      I localI = new I(this);
      this.l.requestDataAsyn(this.a, localI);
    }
  }

  public RelativeLayout a(ViewGroup paramViewGroup)
  {
    RelativeLayout localRelativeLayout = new RelativeLayout(this.a);
    localRelativeLayout.setId(100);
    localRelativeLayout.setVisibility(8);
    localRelativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
    localRelativeLayout.setBackgroundColor(Color.argb(200, 0, 0, 0));
    paramViewGroup.addView(localRelativeLayout);
    return localRelativeLayout;
  }

  void a(ViewGroup paramViewGroup, int paramInt1, int paramInt2)
  {
    int i1;
    Button localButton;
    int i2;
    RelativeLayout.LayoutParams localLayoutParams1;
    LinearLayout localLinearLayout1;
    LayoutInflater localLayoutInflater;
    Iterator localIterator;
    RelativeLayout.LayoutParams localLayoutParams4;
    if (paramInt2 == 0)
    {
      i1 = 10;
      this.k = new t(this.a, paramInt2, false, this.l);
      this.k.setId(0);
      this.k.a(this);
      this.k.a(new a(b.a.b, 1F, 1F));
      localButton = new Button(this.a);
      Resources localResources = this.a.getResources();
      if (paramInt2 != 0)
        break label413;
      i2 = d.c(this.a);
      localButton.setBackgroundDrawable(localResources.getDrawable(i2));
      int i3 = -1;
      if (!(ExchangeConstants.handler_auto_expand))
        i3 = -2;
      localLayoutParams1 = new RelativeLayout.LayoutParams(i3, h.a(ExchangeConstants.TAG_HEIGHT, this.a));
      this.k.c = localButton;
      this.e = localButton;
      this.d = View.inflate(this.a, paramInt1, null);
      localLinearLayout1 = (LinearLayout)this.d.findViewById(b.M(this.a));
      List localList = this.m;
      localLayoutInflater = (LayoutInflater)this.a.getSystemService("layout_inflater");
      localIterator = localList.iterator();
      if (localIterator.hasNext())
        break label425;
      this.d.setVisibility(8);
      this.k.d = this.d;
      localLayoutParams4 = new RelativeLayout.LayoutParams(-1, -2);
      localLayoutParams4.addRule(i1);
      if (paramInt2 != 0)
        break label685;
      this.k.addView(this.d, localLayoutParams4);
      this.k.addView(localButton, localLayoutParams1);
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            this.k.g();
            RelativeLayout localRelativeLayout1 = new RelativeLayout(this.a);
            localRelativeLayout1.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
            localRelativeLayout1.setBackgroundColor(Color.alpha(0));
            if (ExchangeConstants.blur_switcher)
            {
              RelativeLayout localRelativeLayout2 = a(localRelativeLayout1);
              this.k.i = localRelativeLayout2;
            }
            RelativeLayout.LayoutParams localLayoutParams5 = new RelativeLayout.LayoutParams(-1, -2);
            localLayoutParams5.addRule(i1);
            localRelativeLayout1.addView(this.k, localLayoutParams5);
            paramViewGroup.addView(localRelativeLayout1);
            return;
            i1 = 12;
          }
          label413: i2 = d.a(this.a);
        }
        label425: a locala = (a)localIterator.next();
        LinearLayout localLinearLayout2 = (LinearLayout)localLayoutInflater.inflate(a.v(this.a), null);
        localLinearLayout2.setOrientation(1);
        ImageView localImageView = (ImageView)localLinearLayout2.findViewById(b.s(this.a));
        new f(this.a, localImageView, locala.e, Boolean.valueOf(true)).start();
        H localH = new H(this, this.a);
        localH.setEllipsize(TextUtils.TruncateAt.MARQUEE);
        localH.setFocusable(true);
        localH.setSingleLine(true);
        localH.setMarqueeRepeatLimit(-1);
        localH.setGravity(17);
        localH.setTextColor(Color.rgb(0, 0, 0));
        localH.setTypeface(Typeface.DEFAULT_BOLD);
        localH.setText(locala.g);
        localH.setPadding(0, 0, 0, 5);
        LinearLayout.LayoutParams localLayoutParams2 = new LinearLayout.LayoutParams(80, -2);
        localLayoutParams2.gravity = 1;
        localLinearLayout2.addView(localH, localLayoutParams2);
        localLinearLayout2.setBackgroundResource(d.o(this.a));
        localLinearLayout2.setOnTouchListener(new J(this, locala));
        LinearLayout.LayoutParams localLayoutParams3 = new LinearLayout.LayoutParams(120, -2);
        localLayoutParams3.width = 120;
        localLayoutParams3.setMargins(5, 0, 5, 0);
        localLinearLayout1.addView(localLinearLayout2, localLayoutParams3);
      }
      label685: this.k.addView(localButton, localLayoutParams1);
      this.k.addView(this.d, localLayoutParams4);
    }
  }

  public void a(t paramt)
  {
    if (paramt.getId() == 0)
      paramt.a(new a(b.a.b, 1F, 1F));
    while (true)
    {
      paramt.c.setVisibility(0);
      return;
      paramt.a(new c(b.a.b));
    }
  }

  public void a(t paramt, View paramView)
  {
    if (paramt.getId() == 0)
      paramt.a(new c(b.a.b));
    while (true)
    {
      paramt.c.setVisibility(0);
      paramt.f();
      new a(0, this.a, this.m.subList(0, this.j), this.h, 2, 0, this.l.displayStyle).start();
      return;
      paramt.a(new a(b.a.b, 1F, 1F));
    }
  }
}